package game.targets.screen;

import game.targets.Locator;

import java.util.ArrayList;

import com.badlogic.gdx.Game;
import com.badlogic.gdx.Screen;

public class ScreenHandler {

	private RoomScreen roomScreen;
	private MainMenuScreen menuScreen;
	private ScoreScreen scoreScreen;
	private ArrayList<TransitionEffect> effects;
	private Game game;

	public ScreenHandler(Game game) {
		menuScreen = new MainMenuScreen(this, game);
		roomScreen = new RoomScreen(this);
		scoreScreen = new ScoreScreen(this);
		this.game=game;
		effects = new ArrayList<TransitionEffect>();
	}

	private void switchScreen(Screen current, Screen next) {
		// create a transition screen
		effects.clear();
		effects.add(new FadeOutTransitionEffect(0.5f));
		effects.add(new FadeInTransitionEffect(0.5f));

		Screen transitionScreen = new TransitionScreen(Locator.getGame(), current, next, effects);
		game.setScreen(transitionScreen);
	}

	public void setStartScreen() {
		game.setScreen(roomScreen);
		
	}
	
	public void menuToRoom(){
		switchScreen(menuScreen, roomScreen);
	}
	
	public void roomToScore(){
		switchScreen(roomScreen, scoreScreen);
	}
	
	public void scoreToMenu(){
		switchScreen(scoreScreen, menuScreen);
	}
	
	public void scoreToRoom(){
		switchScreen(scoreScreen, roomScreen);
	}
	
	public void roomToMenu(){
		switchScreen(roomScreen, menuScreen);
	}

	public RoomScreen getRoomScreen() {
		return roomScreen;
	}

	public MainMenuScreen getMenuScreen() {
		return menuScreen;
	}

	public ScoreScreen getScoreScreen() {
		return scoreScreen;
	}
	
	
	
}
